/*
 * Copyright 2012 Gregory Zussa
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.gz.gwt.mouse.client.event;

import com.google.gwt.dom.client.Element;
/**
 * Represents a double click event. Decorator class of a 
 * <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/event/dom/client/DoubleClickEvent.html">Native Double Click Event</a> fired by a 
 * <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/Element.html">Dom Element</a>
 * 
 * @see <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/event/dom/client/DoubleClickEvent.html">com.google.gwt.event.dom.client.DoubleClickEvent</a>
 * @see <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/Element.html">com.google.gwt.dom.client.Element</a>
 * 
 * @author gregory.zussa
 */
public class DoubleClickEvent extends MouseEvent<DoubleClickHandler> {
	
	/**
	 * Event type for double click events. 
	 */
	public static Type<DoubleClickHandler> TYPE = new Type<DoubleClickHandler>();
	
	/**
	 * Constructor, use <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/event/shared/HandlerManager.html#fireEvent(com.google.gwt.event.shared.GwtEvent)">HandlerManager#fireEvent</a>
	 * to fire double click events.
	 */
	public DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent event, Element target) {
		super(event, target);
	}
	
	/**
	 * Simple Constructor
	 */
	public DoubleClickEvent(int clientX, int clientY, int nativeButton,
			int relativeX, int relativeY, int screenX, int screenY, int x,
			int y) {
		super(clientX,
				clientY,
				nativeButton,
				relativeX,
				relativeY,
				screenX,
				screenY,
				x,
				y);
		
	}
	
	/**
	 * Gets the event type associated with double click events.
	 * 
	 * @return the handler type
	 */
	@Override
	public Type<DoubleClickHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(DoubleClickHandler handler) {
		handler.onDoubleClick(this);
	}
}
